//
// Created by 21577 on 2025/3/4.
//
#include<stdio.h>

int main(){
    int x;
    scanf("%d",&x);
    int arr[32];
    int i,count;
    for(i=0;x!=0;i++){
        arr[i]=x%10;
        x=x/10;
    }
    count = i;
    printf("%d\n",i);
    for(i=i-1;i>=0;i--){
        printf("%d ",arr[i]);
    }
    printf("\n");
    for(int j=0;j<count;j++){
        printf("%d",arr[j]);
    }
    printf("\n");
    return 0;
}